package dm1101.demo05;

import dm1101.demo03.Lock;

/**
 * @author Ln
 * @version 终极版
 * @date 2022/11/1 18:02
 */
public class Pen extends Thread{
    @Override
    public void run() {
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        synchronized (Lock.lock1){
            System.out.println(Thread.currentThread().getName()+"获取画笔");
            synchronized (Lock.lock2){
                System.out.println(Thread.currentThread().getName()+"获取画板");
                System.out.println(Thread.currentThread().getName()+"开始创造艺术");
            }
        }
    }
}
